package com.qdlc.p2p.dal.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.qdlc.p2p.dal.common.dao.jpa.BaseDaoImpl;
import com.qdlc.p2p.dal.dao.AccountBankDao;
import com.qdlc.p2p.dal.dto.AccountBank;
import com.qdlc.p2p.dal.mybatis.model.mapper.AccountBankMapper;

@Repository("accountBankDao")
public class AccountBankDaoImpl extends BaseDaoImpl<AccountBank> implements AccountBankDao {

	@Resource
	AccountBankMapper accountBankMapper;
	
	@Override
	public List<AccountBank> list(long userId) {
		List<AccountBank> list = accountBankMapper.findByUserId(userId);
		return list;
	}

	@Override
	public List<AccountBank> listAll(long userId) {
		List<AccountBank> list = accountBankMapper.findAllByUserId(userId);
		return list;
	}

	@Override
	public int count(long userId) {
		int count = accountBankMapper.countByUserId(userId);
		return count;
	}

	@Override
	public void disable(long userId, String bankNo) {
		accountBankMapper.disable(userId, bankNo);
	}

	@Override
	public AccountBank find(long userId, String bankNo) {
		AccountBank accountBank = accountBankMapper.findByUserIdAndBankNo(userId, bankNo);
		return accountBank;
	}
	
}
